package com.atguigu.guli.service.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.atguigu.guli.service.*.mapper")
public class MybatisPlusConfig {
    @Bean //乐观锁,进行拦截
    public OptimisticLockerInterceptor optimisticLockerInterceptor(){
        return new OptimisticLockerInterceptor();
    }

    @Bean  //进行分页查询时,进行拦截
    public PaginationInterceptor paginationInterceptor(){
        return new PaginationInterceptor();
    }
}
